package com.wwh.controller;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wwh.mapper.PostMapper;
import com.wwh.model.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class HomeController {

    /**
     * 默认首页，可以查看所有人的文章
     * @param m
     * @return
     * @throws Exception
     */
    @RequestMapping("/index")
    public String hello(Model m) throws Exception {
    	m.addAttribute("now", DateFormat.getDateTimeInstance().format(new Date()));
//    	if(true){
//    		throw new Exception("some exception");
//    	}
        return "home/index";
    }

    /**
     *
     * @param msg
     * @return
     */
    @RequestMapping("/errorPage")
    public String error(String msg){

        return "errorPage";
    }
}
